import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:raze/potions/raze_constant.dart';
import 'package:raze/potions/spatial_alchemy.dart';

/// 幸运植物引导弹窗
/// 用于引导用户前往每日幸运植物页面
class FortuneFloraDialog {
  /// 显示幸运植物引导弹窗
  static void manifestGuidance() {
    Get.dialog(
      const _FortuneFloraDialogWidget(),
      barrierDismissible: true,
      barrierColor: RazeConstants.black.withOpacity(0.5),
    );
  }
}

class _FortuneFloraDialogWidget extends StatelessWidget {
  const _FortuneFloraDialogWidget();

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Material(
        color: Colors.transparent,
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: 24.w),
          padding: EdgeInsets.all(24.w),
          decoration: BoxDecoration(
            color: RazeConstants.yellow,
            borderRadius: BorderRadius.circular(24.r),
            border: Border.all(color: RazeConstants.black, width: 2.w),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              // 标题文本
              Text(
                    'Meet A Plant "Every Day," And Find Natural Emotional Resonance Through Observation And Inspiration.',
                    textAlign: TextAlign.center,
                  )
                  .applyTypeSize(18.sp)
                  .applyTypeColor(RazeConstants.white)
                  .applyBagelFatOne(
                    weight: FontWeight.w400,
                    shadows: [
                      Shadow(
                        offset: Offset(-1.w, -1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(1.w, -1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(-1.w, 1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(1.w, 1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(0, -1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(0, 1.w),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(-1.w, 0),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                      Shadow(
                        offset: Offset(1.w, 0),
                        blurRadius: 0,
                        color: RazeConstants.black,
                      ),
                    ],
                  ),
              24.h.boxHeight,

              // 按钮行
              Row(
                children: [
                  // Cancel 按钮
                  Expanded(
                    child: Container(
                          height: 50.h,
                          decoration: BoxDecoration(
                            color: RazeConstants.white,
                            borderRadius: BorderRadius.circular(16.r),
                            border: Border.all(
                              color: RazeConstants.black,
                              width: 2.w,
                            ),
                          ),
                          child: Center(
                            child: Text('Cancel')
                                .applyTypeSize(16.sp)
                                .applyTypeColor(RazeConstants.black)
                                .applyBagelFatOne(weight: FontWeight.w400),
                          ),
                        )
                        .withRightBottomShadow(thickness: 1.5)
                        .withTouchResonance(onTap: () => Get.back()),
                  ),

                  16.w.boxWidth,

                  // Go To Generate 按钮
                  Expanded(
                    child: Container(
                          height: 50.h,
                          decoration: BoxDecoration(
                            color: RazeConstants.white,
                            borderRadius: BorderRadius.circular(16.r),
                            border: Border.all(
                              color: RazeConstants.black,
                              width: 2.w,
                            ),
                          ),
                          child: Center(
                            child: Text('Go To Generate')
                                .applyTypeSize(16.sp)
                                .applyTypeColor(RazeConstants.black)
                                .applyBagelFatOne(weight: FontWeight.w400),
                          ),
                        )
                        .withRightBottomShadow(thickness: 1.5)
                        .withTouchResonance(
                          onTap: () {
                            Get.back();
                            Get.toNamed('/fortune-flora');
                          },
                        ),
                  ),
                ],
              ),
            ],
          ),
        ).withRightBottomShadow(thickness: 2),
      ),
    );
  }
}
